package com.dai.bean.tasks;

import com.dai.bean.TaskType;
import org.json.JSONObject;

public class TaskHeShui extends TaskBase{
    public static final TaskType taskType = TaskType.HeShuiDaka;

    // 表示8杯水的状态
    public int a1,a2,a3,a4,a5,a6,a7,a8;

    @Override
    public JSONObject toJsonObject() {
        JSONObject object = new JSONObject();
        object.put("a1",a1);
        object.put("a2",a2);
        object.put("a3",a3);
        object.put("a4",a4);
        object.put("a5",a5);
        object.put("a6",a6);
        object.put("a7",a7);
        object.put("a8",a8);
        return object;
    }

    @Override
    public void checkReset() {
        a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = 0;
    }

    @Override
    public String getTaskTypeName() {
        return taskType.getValue();
    }

    public void updateValue(int heShuiId,int value){
        switch (heShuiId){
            case 1:
                a1 = value;
                break;
            case 2:
                a2 = value;
                break;
            case 3:
                a3 = value;
                break;
            case 4:
                a4 = value;
                break;
            case 5:
                a5 = value;
                break;
            case 6:
                a6 = value;
                break;
            case 7:
                a7 = value;
                break;
            case 8:
                a8 = value;
                break;
            default:
                throw new RuntimeException("undef heShuiId:" + heShuiId);
        }
    }
}
